package com.okchan.service.impl;

import com.okchan.dao.BookDao;
import com.okchan.domain.Book;
import com.okchan.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Ok chan
 */
@Service
public class BookServiceImpl implements BookService {
    @Autowired
    private BookDao bookDao;

    @Override
    public Book selectBookById(String bookId) {
        return bookDao.selectBookById(bookId);
    }

    //查询所有图书
    @Override
    public List<Book> booAll() {
        List<Book> bookList = bookDao.booAll();
        return bookList;
    }

    @Override
    public Book createBook(final Book book) {
        this.bookDao.createBook(book);//this？？？
        return book;
    }

    @Override
    public Book deleteBookId(Book bookId) {
        this.bookDao.deleteBookId(bookId);
        return bookId;
    }

    @Override
    public Book updateBook(Book bookName) {
        this.bookDao.updateBook(bookName);
        return bookName;
    }
}
